import "babel-polyfill";
import "classlist-polyfill";
import Vue from "vue";
import axios from "./router/axios";
import VueAxios from "vue-axios";
import App from "./App";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import animate from "animate.css";
import Avue from "@smallwei/avue";
import "@smallwei/avue/lib/index.css";
import AvueFormDesign from "@sscfaith/avue-form-design";
import "./permission"; // 权限
import "./error"; // 日志
import router from "./router/router";
import store from "./store";
import * as filters from "./filters"; // 全局filter
import "./styles/common.scss";
import basicContainer from "./components/basic-container/main";
import RightToolbar from "./components/RightToolbar"
import Pagination from "@/components/Pagination";

import plugins from './plugins' // plugins
import webSocketGlobal from "@/WebSocketGlobal";
Vue.use(plugins)
// 字典标签组件
import DictTag from '@/components/DictTag'

// 导入全局字典匹配方法
import {DICT_TYPE, getDictData, getDictDataByType, getDictDatas2} from '@/util/bpm/dict-util'
import {addBeginAndEndTime, resetForm} from '@/util/bpm/index'
import {loadStyle, downBlobFile} from "@/util/util";
import {validatenull} from "@/util/validate";
import {handleTree} from "@/util/bpm/TreeUtil";


// 挂载常用全局方法，import 引入
Vue.prototype.validatenull = validatenull;
Vue.prototype.downBlobFile = downBlobFile;
Vue.prototype.getDictData = getDictData;
Vue.prototype.getDictDatas2 = getDictDatas2;
Vue.prototype.getDictDataByType = getDictDataByType;
Vue.prototype.DICT_TYPE = DICT_TYPE;
Vue.prototype.addBeginAndEndTime = addBeginAndEndTime;
Vue.prototype.resetForm = resetForm;
Vue.prototype.handleTree = handleTree;
// 挂载websocket到全局
Vue.prototype.$webSocketGlobal = webSocketGlobal;

window.axios = axios;
Vue.use(VueAxios, axios);

Vue.use(ElementUI, {
  size: "small",
  menuType: "text"
});

Vue.use(Avue, {
  size: "small",
  menuType: "text"
});

Vue.use(router);

Vue.use(animate);

Vue.use(AvueFormDesign);

/**
 * Vue.use与vue.component的区别
 * Vue.use是注册插件,而vue.component是注册组件.差别就像是Vue.use=只能穿戴,vue.component=手机.Vue.use比vue.component更强大,一般是由多个组件组成.
 */
// bpmnProcessDesigner 需要引入
import MyPD from "@/components/bpm/bpmnProcessDesigner/package/index.js";

Vue.use(MyPD);
import "@/components/bpm/bpmnProcessDesigner/package/theme/index.scss";
import "bpmn-js/dist/assets/diagram-js.css";
import "bpmn-js/dist/assets/bpmn-font/css/bpmn.css";
import "bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css";
import "bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css";


// 注册全局容器
Vue.component("basicContainer", basicContainer);
Vue.component('DictTag', DictTag)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Pagination', Pagination)

//加载过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");

//设置主题为 DB2

document.body.className = "theme-iview";
